/*
 * @(#)EvolutionControl.java   09/09/14
 * 
 * Copyright (C) 2009 Ecole des Mines d'Ales
 *
 * This library itfP free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library itfP distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact: yulinz88@gmail.com
 *
 *
 *
 */



package fr.ema.arch3d.editor.mainGUI.EvolutionGUI;

import org.dyno.visual.swing.layouts.Constraints;
import org.dyno.visual.swing.layouts.GroupLayout;
import org.dyno.visual.swing.layouts.Leading;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;

//VS4E -- DO NOT REMOVE THIS LINE!

/**
 * Class description
 *
 *
 * @version        1.0, 09/09/13
 * @author         Huaxi (Yulin) ZHANG
 */
public class EvolutionControl extends JFrame {

    /** Field description */
    private static final String PrefERRED_LOOK_AND_FEEL = "javax.swing.plaf.metal.MetalLookAndFeel";

    /** Field description */
    private static final long serialVersionUID = 1L;

    /** Field description */
    private JButton jButtonOpen;

    /** Field description */
    private JComboBox jComboBoxElement;

    /** Field description */
    private JComboBox jComboBoxLevel;

    /** Field description */
    private JComboBox jComboBoxOperation;

    /** Field description */
    private JLabel jLabelChooseChange;

    /** Field description */
    private JLabel jLabelElement;

    /** Field description */
    private JLabel jLabelLevel;

    /** Field description */
    private JLabel jLabelOperation;

    /** Field description */
    private JPanel jPanelRequest;

    /** Field description */
    private JScrollPane jScrollPaneChangeTable;

    /** Field description */
    private JTabbedPane jTabbedPane0;

    /** Field description */
    private JTable jTableChange;

    /** Field description */
    private JTextField jTextFieldChangeDesPlace;

    /**
     * Constructs ...
     *
     */
    public EvolutionControl() {
        initComponents();
    }

    private void initComponents() {
        setLayout(new GroupLayout());
        add(getJTabbedPane0(), new Constraints(new Leading(16, 698, 10, 10), new Leading(6, 294, 10, 10)));
        setSize(731, 321);
    }

    private JScrollPane getJScrollPaneChangeTable() {
        if (jScrollPaneChangeTable == null) {
            jScrollPaneChangeTable = new JScrollPane();
            jScrollPaneChangeTable.setViewportView(getJTableChange());
        }

        return jScrollPaneChangeTable;
    }

    private JTable getJTableChange() {
        if (jTableChange == null) {
            jTableChange = new JTable();
            jTableChange.setModel(new DefaultTableModel(new Object[][] {
                { "Level", "", }, { "Operation", "", },
            }, new String[] { "Name", "Value", }) {
                private static final long serialVersionUID = 1L;
                Class<?>[]                types            = new Class<?>[] { Object.class, Object.class, };
                public Class<?> getColumnClass(int columnIndex) {
                    return types[columnIndex];
                }
            });
        }

        return jTableChange;
    }

    private JButton getJButtonOpen() {
        if (jButtonOpen == null) {
            jButtonOpen = new JButton();
            jButtonOpen.setText("Open");
        }

        return jButtonOpen;
    }

    private JTextField getJTextFieldChangeDesPlace() {
        if (jTextFieldChangeDesPlace == null) {
            jTextFieldChangeDesPlace = new JTextField();
        }

        return jTextFieldChangeDesPlace;
    }

    private JLabel getJLabelChooseChange() {
        if (jLabelChooseChange == null) {
            jLabelChooseChange = new JLabel();
            jLabelChooseChange.setText("Choose a change description");
        }

        return jLabelChooseChange;
    }

    private JComboBox getJComboBoxElement() {
        if (jComboBoxElement == null) {
            jComboBoxElement = new JComboBox();
            jComboBoxElement.setModel(new DefaultComboBoxModel(new Object[] { "Component", "Connector",
                    "Connection" }));
            jComboBoxElement.setDoubleBuffered(false);
            jComboBoxElement.setBorder(null);
        }

        return jComboBoxElement;
    }

    private JComboBox getJComboBoxOperation() {
        if (jComboBoxOperation == null) {
            jComboBoxOperation = new JComboBox();
            jComboBoxOperation.setModel(new DefaultComboBoxModel(new Object[] { "Add", "Delete", "Replace" }));
            jComboBoxOperation.setDoubleBuffered(false);
            jComboBoxOperation.setBorder(null);
        }

        return jComboBoxOperation;
    }

    private JComboBox getJComboBoxLevel() {
        if (jComboBoxLevel == null) {
            jComboBoxLevel = new JComboBox();
            jComboBoxLevel.setModel(new DefaultComboBoxModel(new Object[] { "AbstractSpecification", "Configruation",
                    "Assembly" }));
            jComboBoxLevel.setDoubleBuffered(false);
            jComboBoxLevel.setBorder(null);
        }

        return jComboBoxLevel;
    }

    private JLabel getJLabelElement() {
        if (jLabelElement == null) {
            jLabelElement = new JLabel();
            jLabelElement.setText("Element");
        }

        return jLabelElement;
    }

    private JLabel getJLabelOperation() {
        if (jLabelOperation == null) {
            jLabelOperation = new JLabel();
            jLabelOperation.setText("Operation");
        }

        return jLabelOperation;
    }

    private JLabel getJLabelLevel() {
        if (jLabelLevel == null) {
            jLabelLevel = new JLabel();
            jLabelLevel.setText("Level");
        }

        return jLabelLevel;
    }

    private JPanel getJPanelRequest() {
        if (jPanelRequest == null) {
            jPanelRequest = new JPanel();
            jPanelRequest.setLayout(new GroupLayout());
            jPanelRequest.add(getJLabelLevel(), new Constraints(new Leading(19, 49, 12, 12), new Leading(20, 12, 12)));
            jPanelRequest.add(getJComboBoxLevel(), new Constraints(new Leading(88, 10, 10), new Leading(16, 12, 12)));
            jPanelRequest.add(getJLabelOperation(), new Constraints(new Leading(19, 12, 12), new Leading(54, 12, 12)));
            jPanelRequest.add(getJLabelElement(),
                              new Constraints(new Leading(19, 56, 12, 12), new Leading(87, 12, 12)));
            jPanelRequest.add(getJComboBoxOperation(),
                              new Constraints(new Leading(88, 104, 12, 12), new Leading(50, 10, 10)));
            jPanelRequest.add(getJComboBoxElement(),
                              new Constraints(new Leading(87, 106, 12, 12), new Leading(83, 12, 12)));
            jPanelRequest.add(getJLabelChooseChange(),
                              new Constraints(new Leading(260, 10, 10), new Leading(20, 12, 12)));
            jPanelRequest.add(getJTextFieldChangeDesPlace(),
                              new Constraints(new Leading(260, 335, 10, 10), new Leading(42, 12, 12)));
            jPanelRequest.add(getJButtonOpen(), new Constraints(new Leading(601, 12, 12), new Leading(39, 23, 12, 12)));
            jPanelRequest.add(getJScrollPaneChangeTable(),
                              new Constraints(new Leading(259, 409, 10, 10), new Leading(76, 167, 10, 10)));
        }

        return jPanelRequest;
    }

    private JTabbedPane getJTabbedPane0() {
        if (jTabbedPane0 == null) {
            jTabbedPane0 = new JTabbedPane();
            jTabbedPane0.addTab("Request", getJPanelRequest());
        }

        return jTabbedPane0;
    }

    private static void installLnF() {
        try {
            String lnfClassname = PrefERRED_LOOK_AND_FEEL;

            if (lnfClassname == null) {
                lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName();
            }

            UIManager.setLookAndFeel(lnfClassname);
        } catch (Exception e) {
            System.err.println("Cannot install " + PrefERRED_LOOK_AND_FEEL + " on this platform:" + e.getMessage());
        }
    }

    /**
     * Main entry of the class.
     * Note: This class itfP only created so that you can easily preview the result at runtime.
     * It itfP not expected to be managed by the designer.
     * You can modify it as you like.
     */
    public static void main(String[] args) {
        installLnF();
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                EvolutionControl frame = new EvolutionControl();

                frame.setDefaultCloseOperation(EvolutionControl.EXIT_ON_CLOSE);
                frame.setTitle("EvolutionControl");
                frame.getContentPane().setPreferredSize(frame.getSize());
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }
}
